import com.jayway.android.robotium.solo.Solo;

import android.app.Activity;
import android.cs2340UDT.CS2340AndroidUDTActivity;
import android.cs2340UDT.MainScreenActivity;
import android.cs2340UDT.MapScreenActivity;
import android.test.InstrumentationTestCase;
import junit.framework.TestCase;
import android.test.ActivityInstrumentationTestCase2;


public class AlanTest2 extends ActivityInstrumentationTestCase2<CS2340AndroidUDTActivity> {
	private Solo solo;
	
	Activity myActivity; 
	public AlanTest2() {
		super("com.android.cs2340UDT.CS2340AndroidUDTActivity", CS2340AndroidUDTActivity.class);
		}
	
	public AlanTest2(String pkg, Class<CS2340AndroidUDTActivity> activityClass) { 
        super(pkg, activityClass);
	}
	
	public void setUp() throws Exception {
		super.setUp();
		myActivity = super.getActivity() ; 
		solo = new Solo(getInstrumentation(), getActivity()); //takes in the instrumentation and the start activity.
	}
	
	
	
	public void testCurrentActivity() {
		boolean actual = solo.searchText("Register New Account");
		boolean expected = true;
		assertEquals(actual, expected);
	}
	
	
	
	public void testCreateListOperation() throws Exception {
		solo.clickOnText("Register New Account");
		solo.clickOnText("Create Account");
		solo.clickOnText("Login");
		solo.clickOnImageButton(2);
		solo.enterText(0, "Mob");
		solo.clickOnText("Create New List");
		boolean expected = true;
		boolean actual = solo.searchText("Mob");
		assertEquals(expected, actual);
		
		solo.clickOnText("Mob");
		solo.clickOnImageButton(2);
		solo.enterText(0, "Westside Story");
		solo.enterText(1, "New York City");
		solo.enterText(2, "04");
		solo.enterText(3, "12");
		solo.enterText(4, "2011");
		solo.enterText(5, "Throw down with the sharks!");
		solo.clickOnText("Create Task");
		boolean expected2 = true;
		boolean actual2 = solo.searchText("Westside Story");
		assertEquals(expected2, actual2);
	}
	
	
	
	  
	  protected void tearDown() throws Exception { 
          super.tearDown(); 
  } 
		
	
	
}